#pragma once
#include <string>
#include <list>
#include "Word.h"
#ifdef _WIN32
#include <hash_map>
#else
#include <map>
#endif

using namespace std;

#ifdef _WIN32
typedef hash_map<string, CWord*> MapWords;
typedef hash_map<int, list<CWord*> > ListWords;
#else
typedef map<string, CWord*> MapWords;
typedef map<int, list<CWord*> > ListWords;
#endif

class CDictionary
{
public:
	CDictionary(void);
	~CDictionary(void);
	bool ReadWordsFromFiles(const string& fileName);
	int GetCandidates(const int length, const map<char,int>& goal, list<CWord*>& candidates);
	int Search(const list<CWord*>& wordList1, list<CWord*> wordList2, const map<char, int>& goal);
private:
	int ParseLine(const string& line);
	int GetLength(const map<char,int> & m);
	void Print(const list<string>& wordList1, const list<string>& wordList2);
	size_t GetMemoryUsage(int i);
private:
	MapWords m_dictionary;
	ListWords m_category;
};

